<template>
  <div class="book">
    <span>书本信息</span>
    <div class="book-text">
      <div class="book-text-item">
        <label class="label">出版社</label>
        <span class="label-value">{{ bookDetail.publisher }}</span>
      </div>
      <div class="book-text-item">
        <label class="label">出版年</label>
        <span class="label-value">{{ bookDetail.pubdate }}</span>
      </div>
      <div class="book-text-item">
        <label class="label">页数</label>
        <span class="label-value">{{ bookDetail.pages }}</span>
      </div>
      <div class="book-text-item">
        <label class="label">定价</label>
        <span class="label-value">{{ bookDetail.price }}</span>
      </div>
      <div class="book-text-item">
        <label class="label">精装</label>
        <span class="label-value">{{ bookDetail.binding }}</span>
      </div>
      <div class="book-text-item">
        <label class="label">种类</label>
        <span class="label-value">{{ bookDetail.category }}</span>
      </div>
      <div class="book-text-item">
        <label class="label">翻译</label>
        <span class="label-value">{{ translators }}</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: ['bookDetail'],
  computed: {
    translators() {
      const { translator = [] } = this.bookDetail
      return translator.length > 1 ? translator.join('、') : translator[0]
    }
  },
};
</script>

<style scoped>
.book {
  background-color: #fff;
  text-align: center;
  padding: 10rpx;
  margin-bottom: 90rpx;
}
.book-text {
  font-size: 24rpx;
  display: flex;
  flex-direction: column;
}
.book-text-item {
  line-height: 40rpx;
  display: flex;
  justify-content: space-between;
}
.label {
  color: #bbb;
  display: inline-block;
  width: 20%;
  text-align: right;
}
.label-value {
  display: inline-block;
  width: 70%;
  text-align: left;
}
</style>